 /**
  *
  *
  * @param {元素} el 
  * @param {颜色} colors
  */
 function unitStatistics(el, colors) {
     var option = {
         tooltip: {
             trigger: 'axis',
             axisPointer: {
                 type: 'shadow'
             },
             formatter: function (params) {
                 return params[0].name + ': ' + params[0].value + "次";
             }
         },
         grid: {
             top: "15%",
             bottom: "14%"
         },
         xAxis: {
             data: ['水利局', '环保局', '业主单位', '中介机构', '人防办', '住建局', '发改局'],
             axisTick: {
                 show: false
             },
             axisLine: {
                 show: true,
                 lineStyle: {
                     color: '#fff',
                     width: 2,
                 }
             },
             axisLabel: {
                 show: true,
                 textStyle: {
                     color: '#fff'
                 },
                 fontSize: 12,
             }
         },
         yAxis: [{
                 name: "数量/次",
                 nameTextStyle: {
                     show: true,
                     textStyle: {
                         color: "#fff"
                     }
                 },
                 splitLine: {
                     show: false
                 },
                 axisTick: {
                     show: true
                 },
                 axisLine: {
                     show: true,
                     lineStyle: {
                         color: '#fff',
                         width: 2,
                     }
                 },
                 axisLabel: {
                     show: true,
                     textStyle: {
                         color: '#fff'
                     },
                     fontSize: 12,
                 }

             },
             {
                 type: 'value',
                 gridIndex: 0,
                 min: 80,
                 max: 100,
                 splitNumber: 3,
                 splitLine: {
                     show: false
                 },
                 axisLine: {
                     show: false
                 },
                 axisTick: {
                     show: false
                 },
                 axisLabel: {
                     show: false
                 },
                 splitArea: {
                     show: true,
                     areaStyle: {
                         color: ['#11404F', '#061E31']
                     }
                 }
             }
         ],
         series: [{
             name: 'hill',
             type: 'pictorialBar',
             barCategoryGap: '-130%',
             animationDuration: 5000,
             symbol: 'path://M0,10 L10,10 C5.5,10 5.5,5 5,0 C4.5,5 4.5,10 0,10 z',
             itemStyle: {
                 normal: {
                     opacity: 0.5
                 },
                 emphasis: {
                     opacity: 1
                 }
             },
             data: [123, 60, 25, 160, 12, 150, 2, 1],
             z: 10
         }, {
             name: 'glyph',
             animationDuration: 5000,
             type: 'pictorialBar',
             barGap: '-100%',
             symbolPosition: 'end',
             symbolSize: 0,
         }],
         color: [colors]
     };

     var myChart = echarts.init(document.getElementById(el));
     myChart.setOption(option);
     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 unitStatistics("unitStatistics", "#63D5FF"); //节点预警数量较多前七
 unitStatistics("overdueSituation", "#63FF9A"); //八个阶段逾期情况统计

 //最多逾期时间与最多超前时间前四项目
 function overdueAdvanced() {
     var option = {
         tooltip: {
             trigger: 'axis',
             axisPointer: {
                 type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
             }
         },
         grid: {
             left: '3%',
             right: '8%',
             bottom: '3%',
             containLabel: true
         },
         xAxis: [{
                 name: "天",
                 nameTextStyle: {
                     color: "#fff",
                 },
                 type: 'value',
                 splitLine: {
                     show: false
                 },
                 axisLine: {
                     lineStyle: {
                         color: '#fff',
                         width: 2,
                     }
                 },
                 axisLabel: {
                     textStyle: {
                         color: '#fff'
                     },
                     fontSize: 12,
                     formatter: '{value}天' //单位
                 },
             },
             {
                 type: 'value',
                 gridIndex: 0,
                 min: 80,
                 max: 100,
                 splitNumber: 10,
                 splitLine: {
                     show: false
                 },
                 axisLine: {
                     show: false
                 },
                 axisTick: {
                     show: false
                 },
                 axisLabel: {
                     show: false
                 },
                 splitArea: {
                     show: true,
                     areaStyle: {
                         color: ['#11404F', '#061E31']
                     }
                 }
             }
         ],
         yAxis: [{
             type: 'category',
             data: ['中海创工业4.0示范基地', '城南小学周边地块', '温泉酒店', '周四', '周五'],
             axisLine: {
                 lineStyle: {
                     color: '#fff',
                     width: 2,
                 }
             },
             axisLabel: {
                 textStyle: {
                     color: '#fff'
                 },
                 fontSize: 12,
             },
         }],
         series: [

             {
                 name: '超前',
                 type: 'bar',
                 stack: '总量',
                 animationDuration: 5000,
                 data: [320, '', 41, '', 39]
             },
             {
                 name: '逾期',
                 type: 'bar',
                 stack: '总量',
                 animationDuration: 5000,
                 data: ['', -60, '', -24, '']
             }
         ],
         color: [
             "#58FFF5", "#E56C6C"
         ]
     };

     var myChart = echarts.init(document.getElementById('overdueAdvanced'));
     myChart.setOption(option);
     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 overdueAdvanced();


 //指标录入超期前八家单位次数统计
 function indexEntry() {
     var option = {
         color: ['#3398DB'],
         tooltip: {
             trigger: 'axis',
             formatter: "{b}<br>数量/次：{c}",
             axisPointer: {
                 type: 'shadow', // 默认为直线，可选为：'line' | 'shadow'
                 shadowStyle: {
                     color: 'rgba(20,176,204,.2)' ///修改柱状移动提示背景颜色
                 }
             },
         },
         grid: {
             left: '2%',
             right: '2%',
             bottom: '3%',
             top: '20%',
             containLabel: true
         },
         xAxis: [{
             type: 'category',
             data: ['住建局', '商务局', '嵩口镇', '清凉镇', '梧桐镇', '樟城镇', '长庆镇', '同安镇'],
             axisTick: {
                 alignWithLabel: true
             },
             axisLine: {
                 lineStyle: {
                     color: '#fff',
                     width: 2,
                 }
             },
             axisLabel: {
                 textStyle: {
                     color: '#fff'
                 },
                 fontSize: 12,
             },
         }],
         yAxis: [{
                 type: 'value',
                 name: "数量/次",
                 nameTextStyle: {
                     color: "#fff",
                 },
                 axisLine: {
                     lineStyle: {
                         color: '#fff',
                         width: 2,
                     }
                 },
                 axisLabel: {
                     textStyle: {
                         color: '#fff'
                     },
                     fontSize: 12,
                 },
                 splitLine: {
                     show: false
                 }
             },
             {
                 type: 'value',
                 gridIndex: 0,
                 min: 80,
                 max: 100,
                 splitNumber: 10,
                 splitLine: {
                     show: false
                 },
                 axisLine: {
                     show: false
                 },
                 axisTick: {
                     show: false
                 },
                 axisLabel: {
                     show: false
                 },
                 splitArea: {
                     show: true,
                     areaStyle: {
                         color: ['#11404F', '#061E31']
                     }
                 }
             }
         ],
         series: [{
             name: '',
             type: 'bar',
             animationDuration: 5000,
             barWidth: '60%',
             data: [10, 52, 200, 334, 390, 330, 220, 10],
             barWidth: 20,
         }],
         color: '#58FFF5'
     };

     var myChart = echarts.init(document.getElementById('indexEntry'));
     myChart.setOption(option);
     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 indexEntry();

 //扣分情况
 function pointsSituation() {
     var option = {
         //  tooltip: {},
         radar: {
             shape: 'circle',
             name: {
                 textStyle: {
                     color: '#32CAF6',
                     fontSize: 16,
                     borderRadius: 3,
                     padding: [3, 5]
                 }
             },
             center: ['50%', '50%'],
             // radius: 200,图形大小
             indicator: [{
                     name: '经济发展'
                 },
                 {
                     name: '有效投资'
                 },
                 {
                     name: '机制创新'
                 },
                 {
                     name: '创新驱动'
                 },
                 {
                     name: '生态文明'
                 },
                 {
                     name: '生态文明'
                 }
             ]
         },
         series: [{
             name: '雷达图',
             type: 'radar',
             animationDuration: 5000,
             // symbol: 'circle', // 拐点的样式，还可以取值'rect','angle'等
             symbolSize: '8', // 拐点的大小
             itemStyle: { // 单个拐点标志的样式设置。
                 normal: {
                     borderColor: '#32CAF6', // 拐点的描边颜色。[ default: '#000' ]
                     borderWidth: 3, // 拐点的描边宽度，默认不描边。[ default: 0 ]
                 }
             },
             data: [{
                 value: [0.3, 0.8, 0.6, 1, 0.9, 0.2],
                 areaStyle: {
                     normal: {
                         color: 'rgba(50,202,246,1)'
                     }
                 },
                 label: {
                     normal: {
                         show: true,
                         color: '#FF534D',
                         formatter: function (params) {
                             return "-" + params.value + "分";
                         },
                         fontSize: 16
                     }
                 },
                 lineStyle: {
                     // 修改线的颜色
                     normal: {
                         color: 'rgba(50,202,246,1)'
                     }
                 }
             }]
         }]
     };

     var myChart = echarts.init(document.getElementById('pointsSituation'));
     myChart.setOption(option);
     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 pointsSituation();

 //散点图形
 function scatter() {
     var option = {
         grid: {
             top: "17%",
             left: "25%",
             right: "8%",
             bottom: "15%"
         },
         tooltip: {
             trigger: 'axis',
             formatter: "{c}%", //提示
             axisPointer: { // 坐标轴指示器，坐标轴触发有效
                 type: 'shadow', // 默认为直线，可选为：'line' | 'shadow'
                 shadowStyle: {
                     color: 'rgba(20,176,204,.2)' ///修改柱状移动提示背景颜色
                 }
             },
         },
         xAxis: {
             data: ['葛岭', '城峰', '嵩口', '梧桐', '长庆', '大洋', '福泉'],
             splitLine: {
                 show: true,
                 lineStyle: {
                     type: 'dashed'
                 }
             },
             axisLine: {
                 lineStyle: {
                     color: '#fff',
                     width: 2,
                 }
             },
             axisLabel: {
                 textStyle: {
                     color: '#fff'
                 },
                 fontSize: 12,
             }
         },
         yAxis: {
             axisLine: {
                 show: false,
                 lineStyle: {
                     color: '#fff',
                     width: 2,
                 }
             },
             axisLabel: {
                 show: false,
                 textStyle: {
                     color: '#fff'
                 },
                 fontSize: 14,
             }
         },
         series: [{
             type: 'scatter',
             animationDuration: 5000,
             //  name: '1990',
             symbol: 'circle', //'circle', 'rect', 'roundRect', 'triangle', 'diamond', 'pin', 'arrow'
             symbolSize: function (data) {
                 return Math.sqrt(data[1]) * 2;
             },
             itemStyle: {
                 normal: {
                     color: "#E83A3A" //散点颜色
                 }
             },
             label: {
                 emphasis: {
                     show: true,
                     formatter: function (param) {
                         return param.data[2];
                     },
                     position: 'top'
                 },
                 color: "#fff",
                 fontSize: 14
             },
             data: [
                 ['葛岭', 50],
                 ['城峰', 10],
                 ['嵩口', 5],
                 ['梧桐', 12],
                 ['长庆', 10],
                 ['大洋', 56],
                 ['福泉', 99]
             ]
         }]
     };
     var myChart = echarts.init(document.getElementById('scatter'));
     myChart.setOption(option);
     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 scatter();

 //逾期较多项目
 function overdueProject() {
     var option = {
         tooltip: {
             trigger: 'item',
             formatter: "{a} <br>{b} : {c}%"
         },
         series: [{
             name: '点击率排名',
             type: 'funnel',
             animationDuration: 5000,
             sort: 'ascending',
             x: '25%',
             y: "10%",
             left: "20%",
             width: "40%",
             height: "90%",
             itemStyle: {
                 normal: {
                     label: {
                         position: 'right',
                         color: "#fff",
                         fontWeight: "normal"
                     }
                 }
             },
             markArea: {
                 label: {
                     color: "#fff"
                 }
             },
             data: [{
                     value: 1,
                     name: '发改局'
                 },
                 {
                     value: 2,
                     name: '住建局'
                 },
                 {
                     value: 3,
                     name: '国土局'
                 },
                 {
                     value: 4,
                     name: '林业局'
                 },
                 {
                     value: 5,
                     name: '环保局'
                 },
                 {
                     value: 6,
                     name: '水利局'
                 },
                 {
                     value: 7,
                     name: '财政局'
                 },
                 {
                     value: 8,
                     name: '人社局'
                 },
                 {
                     value: 9,
                     name: '人防办'
                 },
                 {
                     value: 10,
                     name: '消防中队'
                 }
             ],
             label: {
                 normal: {
                     formatter: '{b}  {c}次',
                     fontSize: 16
                 }
             }
         }],
         color: ["#E64437", "#D81F5F", "#914B99", "#5566AF", "#348BCB", "#15B0C6", "#48A74F", "#87BA4C", "#F3E244"]
     };

     var myChart = echarts.init(document.getElementById('overdueProject'));
     //点击事件
     myChart.on('click', function (params) {
         console.log(params.name);
     });

     myChart.setOption(option);

     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 overdueProject();


 /**
  *
  *
  * @param {元素} el
  * @param {图表颜色} colors
  */
 function transverseBar(el, colors) {
     var option = {
         grid: {
             left: '3%',
             top: "10%",
             bottom: "8%",
             containLabel: true
         },
         tooltip: {
             trigger: 'axis',
             axisPointer: { // 坐标轴指示器，坐标轴触发有效
                 type: 'shadow' // 默认为直线，可选为：'line' | 'shadow'
             },
             formatter: "{b} : {c}次"
         },
         xAxis: [{
                 name: '',
                 type: 'value',
                 splitLine: {
                     show: false
                 },

                 axisLine: {
                     lineStyle: {
                         color: '#fff',
                         width: 2,
                     }
                 },

                 axisLabel: {
                     textStyle: {
                         color: '#fff'
                     },
                     fontSize: 14,
                     formatter: '{value}次' //单位
                 },
             },
             {
                 type: 'value',
                 gridIndex: 0,
                 min: 80,
                 max: 100,
                 splitNumber: 10,
                 splitLine: {
                     show: false
                 },
                 axisLine: {
                     show: false
                 },
                 axisTick: {
                     show: false
                 },
                 axisLabel: {
                     show: false
                 },
                 splitArea: {
                     show: true,
                     areaStyle: {
                         color: ['#11404F', '#061E31']
                     }
                 }
             }
         ],
         yAxis: {
             type: 'category',
             data: ['重大招商小分队', '指挥信息产业园招商小分队', '全程旅游招商小分队', '生态农业招商小分队', ],
             axisLine: {
                 lineStyle: {
                     color: '#fff',
                     width: 2,
                 }
             },
             axisLabel: {
                 textStyle: {
                     color: '#fff'
                 },
                 fontSize: 14,
             },
         },
         series: [{
             name: '',
             type: 'bar',
             animationDuration: 5000,
             stack: '总量',
             data: [320, 302, 301, 800],

         }],
         color: [colors],
         barWidth: 20
     };


     var myChart = echarts.init(document.getElementById(el));
     myChart.setOption(option);
     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 transverseBar("unitWarning", "#CAFF58"); //项目逾期较长单位
 transverseBar("indicatorUnit", "#58FFF5"); //项目逾期较长单位

 //经济指标各月预警总计
 function warningTotal() {
     var option = {
         tooltip: {
             trigger: 'axis',
             formatter: "{b}<br>{c}次",
             axisPointer: {
                 type: 'shadow',
                 shadowStyle: {
                     color: 'rgba(20,176,204,.2)'
                 }
             },
         },
         grid: {
             top: 50,
             bottom: 30,
             left: 50,
             right: 50
         },
         xAxis: {
             type: 'category',
             data: ["1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"],
             axisLine: {
                 show: true,
                 lineStyle: {
                     color: '#fff',
                     width: 2,
                 }
             },
             axisLabel: {
                 show: true,
                 textStyle: {
                     color: '#fff'
                 },
                 fontSize: 12,
             }
         },
         yAxis: [{
             name: "(次)",
             type: 'value',
             axisLine: {
                 show: true,
                 lineStyle: {
                     color: '#fff',
                     width: 2,
                 }
             },
             axisLabel: {
                 show: true,
                 textStyle: {
                     color: '#fff'
                 },
                 fontSize: 12,
             },
             splitLine: {
                 show: false
             }
         }, {
             type: 'value',
             gridIndex: 0,
             min: 80,
             max: 100,
             splitNumber: 3,
             splitLine: {
                 show: false
             },
             axisLine: {
                 show: false
             },
             axisTick: {
                 show: false
             },
             axisLabel: {
                 show: false
             },
             splitArea: {
                 show: true,
                 areaStyle: {
                     color: ['#11404F', '#061E31']
                 }
             }
         }],
         series: [{
             data: [1, 2, 3, 4, 15, 6, 7, 8, 25, 1, 1, 2],
             animationDuration: 5000,
             axisLabel: {
                 interval: 0 //x轴数值全部显示出来
             },
             type: 'line',
             symbol: "circle", //设定为实心点
             symbolSize: 8, //设定实心点的大小
             itemStyle: { //设置折线颜色
                 normal: {
                     color: "#2194FF", //小圆点颜色
                     lineStyle: {
                         color: "#2194FF", //折线颜色
                         width: 3
                     }
                 }
             }
         }]
     };


     var myChart = echarts.init(document.getElementById('warningTotal'));

     myChart.setOption(option);

     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 warningTotal();

 //预警次数较多节点统计
 function warningNumber() {
     data = [{
         "value": 180,
         "name": "征地拆迁"
     }, {
         "value": 100,
         "name": "农用地转用徒地批报"
     }, {
         "value": 16.5,
         "name": "施工图设计"
     }, {
         "value": 15.5,
         "name": "可研编制"
     }, {
         "value": 14.8,
         "name": "消防审核"
     }, {
         "value": 13.7,
         "name": "林地现状调查"
     }, {
         "value": 13.6,
         "name": "土地出让"
     }, {
         "value": 13.4,
         "name": "防洪审批"
     }, {
         "value": 13.1,
         "name": "施工许可证"
     }, {
         "value": 12.6,
         "name": "备案"
     }, {
         "value": 12.6,
         name: "土地"
     }]

     for (var n in data) {
         data[n]['name'] = data[n]['name'] + ' ' + data[n]['value'] + '次'
     }

     var option = {
         tooltip: {
             trigger: 'item',
             formatter: "{b}"
         },
         series: [{
             type: 'treemap',
             width: '100%',
             height: '100%',
             //  top: '15%',
             roam: false, //是否开启拖拽漫游（移动和缩放）
             nodeClick: false, //点击节点后的行为,false无反应
             breadcrumb: {
                 show: false
             },
             label: { //描述了每个矩形中，文本标签的样式。
                 normal: {
                     show: true,
                     position: ['10%', '40%'],
                     fontSize: 14
                 },

             },
             itemStyle: {
                 normal: {
                     show: true,
                     textStyle: {
                         color: '#fff',
                         fontSize: 14,
                     },
                     borderWidth: 1,
                     borderColor: '#fff',
                 },
                 emphasis: {
                     label: {
                         show: true
                     }
                 }
             },
             data: data
         }]
     };


     var myChart = echarts.init(document.getElementById('warningNumber'));
     myChart.setOption(option);
     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }

 warningNumber();


 //增长未达标指标
 function noStandard() {
     var cost = [0.2, 1, 0.87, 0.84, 0.135, 0.27] //进度条（大于1按1处理）
     var dataCost = [170, 12.18, 7.3, 8.4, 13.5, 8.1] //当前占比
     var totalCost = [1, 1, 1, 1, 1, 1] //比例综合
     var visits = [2.8, 3.4, 8.7, 2.2, 4.6, 3.2] //差距占比
     var grade = ['全社会消费品零售总额', '固定资产投资', '建筑业增加值', '规模以上工业增加值', "一般公共收入预算", "地区生产总值"]
     var data = {
         grade: grade,
         cost: cost,
         totalCost: totalCost,
         visits: visits,
         dataCost: dataCost
     };
     var option = {
         grid: {
             top: "5%",
             left: '48%',
             right: '16%',
             bottom: "5%"
         },
         xAxis: {
             show: false,
         },
         yAxis: {
             type: 'category',
             axisLabel: {
                 margin: 100,
                 show: true,
                 fontSize: 14,
                 color: "#fff"
             },
             axisTick: {
                 show: false,
             },
             axisLine: {
                 show: false,
             },
             data: data.grade
         },
         series: [{
             type: 'bar',
             barGap: '-100%',
             label: {
                 normal: {
                     show: true,
                     position: 'right',
                     color: '#fff',
                     fontSize: 14,
                     formatter: function (param) {
                         return '差距: ' + data.visits[param.dataIndex] + '%';
                     },
                 }
             },
             barWidth: '20%',
             itemStyle: {
                 normal: {
                     borderColor: '#4DCEF8',
                     borderWidth: 1,
                     barBorderRadius: 15,
                     color: 'rgba(102, 102, 102,0)'
                 },
             },
             z: 1,
             data: data.totalCost,
             // data: da
         }, {
             type: 'bar',
             barGap: '-99%',
             barWidth: '20%',
             itemStyle: {
                 normal: {
                     barBorderRadius: 16,
                     color: ["#C83E3E"]
                 },
             },
             max: 1,
             label: {
                 normal: {
                     show: true,
                     position: 'left',
                     color: '#fff',
                     fontSize: 14,
                     formatter: function (param) {
                         return "当前: " + data.dataCost[param.dataIndex] + '%';

                     },
                 }
             },
             labelLine: {
                 show: true,
             },
             z: 2,
             data: data.cost,
         }]
     }

     var myChart = echarts.init(document.getElementById('noStandard'));
     myChart.setOption(option);
     window.addEventListener("resize", function () {
         myChart.resize();
     });
 }
 noStandard();


 //文字轮播
 function timer(opj) {
     $(opj).find('ul').animate({
         marginTop: "-3.5rem"
     }, 500, function () {
         $(this).css({
             marginTop: "0.7rem"
         }).find("li:first").appendTo(this);
     })
 }
 $(function () {
     var num = $('.notice_active').find('li').length;
     if (num > 1) {
         var time = setInterval('timer(".notice_active")', 3500);
         $('.gg_more a').mousemove(function () {
             clearInterval(time);
         }).mouseout(function () {
             time = setInterval('timer(".notice_active")', 3500);
         });
     }

     $(".news_ck").click(function () {
         location.href = $(".notice_active .notice_active_ch").children(":input").val();
     })
 });